<template>
  <div>
    <!-- 标题栏 -->
    <van-nav-bar
      title="不凡"
      left-text="返回"
      left-arrow
      fixed
      @click-left="onClickLeft"
    />
    <div class="Action">
      <h3 class="may">我的收藏</h3>
      <div class="items">
        <div class="item" v-for="item in ActionList" :key="item.id">
          <img :src="item.list_pic_url" alt="" />
          <p class="item-t">{{ item.name }}</p>
          <p class="item-b">￥{{ item.retail_price }}</p>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { listAction } from "@/api/home/collect.js";
export default {
  data() {
    return {
      ActionList: [],
    };
  },
  methods: {
    getlistAction() {
      listAction({
        openId: localStorage.getItem("openId"),
      }).then((res) => {
        console.log(res);
        this.ActionList = res.collectGoodsList;
      });
    },
    //返回上一个页面
    onClickLeft() {
      this.$router.go(-1);
    },
  },
  created() {
    this.getlistAction();
  },
};
</script>
<style lang="scss" scoped>
.Action {
  margin-top:52px;
  height: 800px;
  .may{
      width: 100%;
      height:45px;
      line-height: 40px;
      text-align: center;
    background-color: #fff;
  }
  .items {
    margin-top: 5px;
    width: 100%; 
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    background-color: #f4f4f4;
    .item {
      background-color: #fff;
      width: 49%;
      margin-bottom: 10px;
      img {
        width: 100%;
        height: auto;
      }
      .item-t {
        width: 100%;
        height: 16px;
        text-align: center;
        line-height: 16px;
      }
      .item-b {
        width: 100%;
        height: 16px;
        text-align: center;
        line-height: 16px;
        color: #eb2323;
      }
    }
  }
}
</style>